//
//  QuickRegistration.m
//  ArtCircle
//
//  Created by sunbin on 2017/5/19.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "QuickRegistration.h"
#import "Registration.h"

#import "AccountManage.h"
@interface QuickRegistration ()
@property (nonatomic ,strong) OneInputBox *one;

@end

@implementation QuickRegistration

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"注册";
    
    _one = self.contentView.inputBoxView.one;
    
    _one.bottomView.hidden = YES;
    [_one.submitBtn setTitle:@"确定" forState:UIControlStateNormal];
    WEAKSELF;
    

    _one.nextStepHandler = ^(NSString *account, NSInteger make) {
    
        
        [weakSelf.navigationController.view showLoading:@"正在注册"];
        NSDictionary * params= @{@"phone":account};
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [weakSelf.navigationController.view hideHUD];
            
            
            [[AccountManage sharedAccountManage] request:Request apiTy:API_Registration params:params success:^(NSDictionary *results, NSString *successMsg) {
                
                //成功 跳转验证 带参数
                Registration *registration = [[Registration alloc] init];
                registration.phone = account;
                registration.msg = successMsg;
                
                [weakSelf.navigationController pushViewController:registration animated:NO];
                
                
                
            } failed:^(WrapperEnumError errorty, NSString *msg) {
                errorty == Failure? [CommonUtils showAlertWithTaget:weakSelf andMsg:msg]:[weakSelf.navigationController.view showError:msg];
            }];
        });


    };
}
















- (BOOL)isShowAuthorizedLoginView {
    return YES;
}

- (BOOL)isShowAccountHeaderView {
    return NO;
}

- (InputBoxType)getInputBoxType {
    return InputBoxTypeOne;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
